package com.zhos.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhos.demo.model.Users;
import com.zhos.demo.mapper.UsersMapper;
import com.zhos.demo.service.IUsersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author astupidcoder
 * @since 2021-01-03
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements IUsersService {

    @Resource
    private UsersMapper usersMapper;

    @Override
    public List<Users> findAllUser() {
        return usersMapper.findAllUser();
    }

    public Page findPage() {
        Page page = new Page<Users>(1, 10);
        QueryWrapper<Users> wrapper = new QueryWrapper<>();
        wrapper.eq("id", 1);
        Page<Users> users = usersMapper.selectPage(page, wrapper);
        //page.setRecords(users.getRecords());

        return users;
    }
}
